package com.danciyixue.boot.client.userStudyWordHistory.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.danciyixue.boot.common.result.PageResult;
import com.danciyixue.boot.common.result.Result;
import com.danciyixue.boot.dcyx.model.query.UserStudyWordHistoryQuery;
import com.danciyixue.boot.dcyx.model.vo.TodayStudyWordReportVO;
import com.danciyixue.boot.dcyx.model.vo.UserStudyWordHistoryVO;
import com.danciyixue.boot.dcyx.service.UserStudyWordHistoryService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 客户端用户单词学习历史控制器
 */
@Tag(name = "16. 单词学习历史", description = "单词学习历史")
@RestController
@RequestMapping("/api/client/v1/user-study-word-history")
@RequiredArgsConstructor
public class DcyxUserStudyWordHistoryController {

    private final UserStudyWordHistoryService userStudyWordHistoryService;

    /**
     * 获取用户单词学习历史数据
     */
    @GetMapping("/page")
    public PageResult<UserStudyWordHistoryVO> page(UserStudyWordHistoryQuery queryParams) {
        IPage<UserStudyWordHistoryVO> page = userStudyWordHistoryService.getUserStudyWordHistoryPage(queryParams);
        return PageResult.success(page);
    }

    /**
     * 获取用户今日单词学习报告
     */
    @GetMapping("/today")
    @Operation(summary = "获取用户今日单词学习报告")
    public Result<TodayStudyWordReportVO> getTodayStudyWordReport() {
        TodayStudyWordReportVO result = userStudyWordHistoryService.getTodayStudyWordReport();
        return Result.success(result);
    }
} 